/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package nodeLevelMetaModel.impl;

import java.util.Collection;

import nodeLevelMetaModel.Node;
import nodeLevelMetaModel.NodeLevelMetaModelPackage;
import nodeLevelMetaModel.Role;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

import org.eclipse.emf.ecore.util.EObjectResolvingEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Role</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link nodeLevelMetaModel.impl.RoleImpl#getDeploymentCondition <em>Deployment Condition</em>}</li>
 *   <li>{@link nodeLevelMetaModel.impl.RoleImpl#getName1 <em>Name1</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class RoleImpl extends EObjectImpl implements Role {
	/**
	 * The default value of the '{@link #getDeploymentCondition() <em>Deployment Condition</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDeploymentCondition()
	 * @generated
	 * @ordered
	 */
	protected static final String DEPLOYMENT_CONDITION_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getDeploymentCondition() <em>Deployment Condition</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDeploymentCondition()
	 * @generated
	 * @ordered
	 */
	protected String deploymentCondition = DEPLOYMENT_CONDITION_EDEFAULT;

	/**
	 * The cached value of the '{@link #getName1() <em>Name1</em>}' reference list.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getName1()
	 * @generated
	 * @ordered
	 */
	protected EList<Node> name1;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected RoleImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return NodeLevelMetaModelPackage.Literals.ROLE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getDeploymentCondition() {
		return deploymentCondition;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setDeploymentCondition(String newDeploymentCondition) {
		String oldDeploymentCondition = deploymentCondition;
		deploymentCondition = newDeploymentCondition;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, NodeLevelMetaModelPackage.ROLE__DEPLOYMENT_CONDITION, oldDeploymentCondition, deploymentCondition));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EList<Node> getName1() {
		if (name1 == null) {
			name1 = new EObjectResolvingEList<Node>(Node.class, this, NodeLevelMetaModelPackage.ROLE__NAME1);
		}
		return name1;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case NodeLevelMetaModelPackage.ROLE__DEPLOYMENT_CONDITION:
				return getDeploymentCondition();
			case NodeLevelMetaModelPackage.ROLE__NAME1:
				return getName1();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@SuppressWarnings("unchecked")
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case NodeLevelMetaModelPackage.ROLE__DEPLOYMENT_CONDITION:
				setDeploymentCondition((String)newValue);
				return;
			case NodeLevelMetaModelPackage.ROLE__NAME1:
				getName1().clear();
				getName1().addAll((Collection<? extends Node>)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case NodeLevelMetaModelPackage.ROLE__DEPLOYMENT_CONDITION:
				setDeploymentCondition(DEPLOYMENT_CONDITION_EDEFAULT);
				return;
			case NodeLevelMetaModelPackage.ROLE__NAME1:
				getName1().clear();
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case NodeLevelMetaModelPackage.ROLE__DEPLOYMENT_CONDITION:
				return DEPLOYMENT_CONDITION_EDEFAULT == null ? deploymentCondition != null : !DEPLOYMENT_CONDITION_EDEFAULT.equals(deploymentCondition);
			case NodeLevelMetaModelPackage.ROLE__NAME1:
				return name1 != null && !name1.isEmpty();
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (deploymentCondition: ");
		result.append(deploymentCondition);
		result.append(')');
		return result.toString();
	}

} //RoleImpl
